package com.example.first_android.kotlin

fun main() {
   val Jordan=Player("乔丹", 54)
   Jordan.intro()
   Jordan.eat()
   Jordan.run()
}

open class Manager(var name: String) {
    var age: Int
    
    init {
        when(name) {
            "张三" -> age = 18
            "李四" -> age = 20
            "王五" -> age = 22
            "赵六" -> age = 24
            else -> age = 0
        }
    }
    
    constructor(name: String, age: Int) : this(name) {
        this.age = age
    }
    
   open fun intro() {
        println("我的名字是$name，今年${age}岁")
    }
}
class Employee(name: String, age: Int) : Manager(name, age) {
    override fun intro() {
        println("我是一名员工，我的名字是$name，今年${age}岁")
    }
}
interface Man{
    val name:String
    val age:Int
    fun intro(){
        println("我的名字是$name，今年${age}岁")
    }
    fun eat()
    fun run()
}
class Player(override val name: String, override val age: Int) : Man {
    override fun eat() {
        println("我是$name，我正在吃饭")
    }
    override fun run() {
        println("我是$name，我正在跑步")
    }
}